﻿using System;
using System.Collections.Generic;
using StudyTracker.Util;

namespace StudyTracker.Domain.Entities
{
	public class Student : MongoDocument<Student>, IEntity
	{
		public int? Id { get; private set; }

		public string AuthenticationIdentifier { get; private set; }
		public string Email { get; private set; }
		public IList<Subject> Subjects { get; private set; }

		public Student(string authenticationIdentifier, string email)
		{
			AuthenticationIdentifier = authenticationIdentifier;
			Email = email;
			Subjects = new List<Subject>();
		}

		private Student() { }

		public class Subject
		{
			public string Name { get; private set; }
			public IList<StudySession> StudySessions { get; private set; }

			public Subject(string name)
			{
				Name = name.ToTitleCase();
				StudySessions = new List<StudySession>();
			}

			private Subject() { }

			public class StudySession
			{
				public DateTime Date { get; private set; }
				public double Amount { get; private set; }

				public StudySession(double amount)
				{
					Amount = amount;
					Date = DateTime.Now;
				}

				private StudySession() { }
			}
		}
	}
}
